<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>购物车</title>
<link rel="stylesheet"
	href="<c:url value="/statics/bootstrap-3.3.0/css/bootstrap.css"/>">
<link rel="stylesheet"
	href="<c:url value="/statics/jquery-ui-1.12.1/jquery-ui.css"/>">
<link rel="stylesheet"
	href="<c:url value="/statics/jquery-ui-1.12.1/jquery-ui.theme.css"/>">
<link rel="stylesheet" href="<c:url value="/statics/css/style.css"/>">
<script src="<c:url value="/statics/jquery-1.12.4/jquery-1.12.4.js"/>"></script>
<script>
	$(function() {
		var width = $("#type-bar").width();
		$(window).scroll(function() {
			if ($(document).scrollTop() >= $("#search-bar").height()) {
				$("#type-bar").css({
					"position" : "fixed",
					"top" : 150 - $("#search-bar").height() + "px",
					"width" : width
				});
			} else {
				$("#type-bar").css({
					"position" : "fixed",
					"top" : 150 - $(document).scrollTop() + "px",
					"width" : width
				});
			}
		})
	})
</script>
</head>
<body>
	<div>
		<jsp:include page="header.jsp" />
	</div>



	<div class="container">
		<div class="main-content">
	

			<div class="col-md-10" style="margin-top: 10px; float: right;">
				<c:choose>
					<c:when test="${sessionScope.cart.size == 0}">
						<div align="center">
							<img style="width: 500px; height: 350px"
								src="<c:url value="/statics/image/photos/default/shouqing.png"/>">
							<h2>没有商品加入购物车</h2>
						</div>
					</c:when>
					<c:otherwise>
					<table border="1">
							<tr>
								<td>选择商品</td>
								<td>商品编号</td>
								<td>商品详情</td>
								<td>商品名称</td>
								<td>商品价格</td>
								<td>商品数量</td>
								<td>共计</td>
								<td>移除</td>
							</tr>
						<c:forEach var="item" items="${sessionScope.cart.items}">
							<tr>
								<td></td>
								<td>${item.id}</td>
								<td>
								<a target="_blank" href="/secondshop/goods/goodInfo?goodId=${item.good.id}">
								<img src="<c:url value="${item.good.photoUrl}"/> "  width="300px">
								</a>
								</td>
								<td>${item.good.name}</td>
								<td>${item.good.prise}</td>
								<td>${item.number}</td>
								<td>${item.sumMoney}</td>
								<td><a href="/secondshop/goods/removeItem?id=${item.good.id}">移除</a></td>
							</tr>
						</c:forEach>
						<tr>
						<td colspan="7" align="right">总金额:${cart.totalMoney}</td>
						</tr>
						</table>
						<h2 ><a href="/secondshop">继续购物</a>||<a href="goods/pay">支付</a></h2>
						</c:otherwise>
				</c:choose>


						
 
<!--  分页-->
				<div class="col-md-12 column" align="right">
					<ul class="pagination">
						<c:choose>
							<c:when test="${offset >= limit}">
								<li><a
									href="?searchText=${param.searchText}&secondTypeId=${param.secondTypeId}&offset=${offset - limit}">上一页</a>
								</li>
							</c:when>
							<c:otherwise>
								<li class="disabled"><a href="#">上一页</a></li>
							</c:otherwise>
						</c:choose>

						<c:forEach var="page" begin="1" end="${pages}">
							<c:choose>
								<c:when test="${offset == limit * (page - 1)}">
									<li class="disabled"><a href="#">${page}</a></li>
								</c:when>
								<c:otherwise>
									<li><a
										href="?searchText=${param.searchText}&secondTypeId=${param.secondTypeId}&offset=${limit * (page - 1)}">${page}</a>
									</li>
								</c:otherwise>
							</c:choose>
						</c:forEach>

						<c:choose>
							<c:when test="${goods.size() >= limit}">
								<li><a
									href="?searchText=${param.searchText}&secondTypeId=${param.secondTypeId}&offset=${offset + limit}">下一页</a>
								</li>
							</c:when>
							<c:otherwise>
								<li class="disabled"><a href="#">下一页</a></li>
							</c:otherwise>
						</c:choose>
					</ul>
				</div>
			</div>
		</div>
	</div>

	<jsp:include page="footer.jsp" />


	<script src="<c:url value="/statics/jquery-1.12.4/jquery-1.12.4.js"/>"></script>
	<script src="<c:url value="/statics/bootstrap-3.3.0/js/bootstrap.js"/>"></script>
	<script src="<c:url value="/statics/jquery-ui-1.12.1/jquery-ui.js"/>"></script>
	<script
		src="<c:url value="/statics/jquery-ui-1.12.1/datepicker-zh-CN.js"/>"></script>
</body>
</html>